define([
    "ngController"
],function (appAngular) {

    // 底部按钮先关-可拖动模块-2、属性
    appAngular.directive("bimApiModelProperty", function () {
        return {
            restrict: "EA",
            replace: true,
            template: `<div class="draggable model-property" 
                            style="display: {{(btnsSelect.name=='property'&&btnsSelect.check == true)?'block':'none'}}">
						<div class="property-header">
							<h3>属性</h3>
							<img ng-src="{{baseUrl + imgDragClose}}" ng-click="modelDragTitleClose()">
						</div>
						<div class="property-content">
							<details open="open" ng-repeat="item in modelProperty.property">
								<summary style="color: #0696FA;">
								    <span>{{item.name}}</span>
							    </summary>
								<details open ng-repeat="itemList in item.data">
									<summary>
                                        <span>{{itemList.name}}</span>
								    </summary>
									<p ng-repeat="data in itemList.data" ng-if="!data.ajaxTitle">
									    <img ng-src="{{baseUrl+data.img}}">
										<span>{{data.title}}</span>
									</p>
									<table ng-repeat="data in itemList.data" ng-if="data.ajaxTitle">
									    <!-- 避免返回数据格式不标准 -->
                                        <tr ng-repeat="show in data.title.property"
                                        	ng-if="data.title !== null">
                                            <td>{{show.name}}</td>
                                            <td>{{show.value}}</td>
                                        </tr>
                                        <tr ng-if="data.title == null"><td>暂无数据</td><td>暂无数据</td></tr>
                                    </table>
								</details>
							</details>
						</div>
						<!--<div class="property-search">
							<div class="search-btn">
								<label class="search-label">
				            <img src="{{baseUrl + imgSearch}}">
				            <input type="text" placeholder="搜索内容" ng-model="modelProperty.search">
				          </label>
								<button>搜索</button>
							</div>
						</div>-->
					</div>`,
            link: function ($scope, $elem, attrs) {
                // 可拖动模块-2、属性
                $scope.modelProperty = {
                    search: '',
                    property: [
                        {
                            name: '零件一',
                            level: '1',
                            data: [
                                {
                                    name: '尺寸信息',
                                    level: '2',
                                    data: [{
                                        img: $scope.imgIconFilesLittle,
                                        title: '暂无数据',
                                        ajaxTitle: false
                                    }]
                                },
                                {
                                    name: '基本属性',
                                    level: '2',
                                    data: [{
                                        img: $scope.imgIconFilesLittle,
                                        title: '暂无数据',
                                        ajaxTitle: false
                                    }]
                                },
                                {
                                    name: '自定义属性',
                                    level: '2',
                                    data: [{
                                        img: $scope.imgIconFilesLittle,
                                        title: '暂无数据',
                                        ajaxTitle: false
                                    }]
                                }
                            ]
                        }
                    ]
                };
            }
        };
    });

    return appAngular;
});